/**
 * Created by seeker910 on 2020/5/1.
 */
Rsd.define('Rsd.hermit.pages.PrintPage', {
    extend: 'Rsd.container.Page',
    requires: [
        'Rsd.form.Button',
        'Rsd.control.PrintArea'
    ],
    xtype:'print-page',
    layout:{type:'vbox',align:'center'},
    height:'100%',
    width:'100%',
    title:'票据（发票，凭证，审批单）套打',
    //打印模板名称
    templateType:'Rsd.hermit.inner.PrintTemplate',
    //打印数据缓存 键值
    key:'',
    items:[
        {
            xtype: 'print-area', 
            height: 160, 
        },
        {
            xtype:'button',
            print:false,
            width:160,
            height: 40, 
            text:' 立 即 打 印',
            handler:'btn_print'
        },
    ],
    /*
    *
    * */
    constructor: function PrintPage(config) {
        config = config || {};
        Rsd.apply(this, config);
        if(this.templateType)
        {
            this.items[0] = Rsd.create(this.templateType,{label:false});
        }
        else
        {
            this.items[0].label = '未设置模板';
        }
        
    },
    /*
    * */
    load:function () {

        this.items[0].data = Rsd.readSession(this.key)||{};

        this.callParent();
    },
    /**
     * 
     */
    btn_print:function btn_print() {

        Rsd.removeSession(this.key);
        window.print();

    }
});

Rsd.define('Rsd.hermit.inner.PrintTemplate', {
    extend: 'Rsd.control.PrintArea',
    requires: [  'Rsd.form.Button'],
    xtype: 'print-tpl',
    width: '100%',
    height: 420,
    size: {width: 130, height: 100},
    scale:1.4,
    printBorder:true,
    tableBorder:true,
    rows: [ 
        {
            items: [
                {
                    height: 12,
                    colSpan: 7,
                    text: '镇江市住宅专项维修资金补交通知单',
                    align: 'center',
                    print: true,
                    style: {fontSize: '150%',fontWeight:'bold'}
                },
                {
                    rowSpan: 7,
                    width: 4,
                    text: '第二联  业主交款凭证',
                    tag:'div',
                    print: true,
                    style: {writingMode: 'tb-lr', padding: '15px',textAlign:'center'}
                }
            ]
        },
        {
            items: [
                {text: '业主编号', align: 'center', print: true, height: 8, width: 20},
                {colSpan: 2, width: 75,  align: 'center', dataIndex: 'FWDM'},
                {text: '行政区域', align: 'center', print: true, width: 20},
                {colSpan: 1, width: 25,   align: 'center',dataIndex: 'XZQY'},
                {text: '交款类型', align: 'center', print: true, width: 20},
                {colSpan: 1, width: 30,   align: 'center',dataIndex: 'JKLX'}
            ]
        },
        {
            items: [
                {height: 8, width: 20, text: '公安坐落', print: true, align: 'center'},
                {colSpan: 2,   align: 'center',dataIndex: 'DZ'},
                {text: '幢号', print: true, align: 'center'},
                {  align: 'center',dataIndex: 'LDH'},
                {text: '室号', print: true, align: 'center'},
                {  align: 'center',dataIndex: 'SH'}
            ]
        },
        {
            items: [
                {height: 8, width: 20, text: '补交金额', print: true, align: 'center'},
                {width: 50,dataIndex: 'BJJE'},
                {
                    text: '大写',
                    align: 'center',
                    height: 8,
                    print: true,
                    width: 20
                },
                {colSpan: 4,dataIndex: 'JEDX'}]
        },
        {
            items: [
                {height: 8, width: 20, text: '业主姓名', print: true, align: 'center'},
                {width: 50,dataIndex:'YZXM'},
                {
                    text: '身份证号',
                    align: 'center',
                    print: true,
                    height: 8,
                    width: 20
                },
                {colSpan: 4,dataIndex:'SFZH'}
            ]
        },
        {
            items: [
                {text: '监制单位', height: 8, width: 20, print: true, align: 'center'},
                {width: 30,dataIndex:'JZDW'},
                {
                    text: '填报日期',
                    align: 'center',
                    print: true,
                    width: 20
                },
                {colSpan: 2,dataIndex:'TBRQ'},
                {text: '打印日期', print:false,align: 'center'}, {dataIndex: 'DYRQ'}]
        },
        {items: [{colSpan: 7, print: true,height: 12, text: '交款地点：1.中国银行解放路支行 2.行政服务大厅财政收费窗口'}]},
    ]
});
